'''
Date: 2022-03-03 18:27:38
Author: chenbin
LastEditors: chenbin
LastEditTime: 2022-03-03 19:17:08
FilePath: tetsusb.py
Description: 
'''
from usb.backend import libusb1
import usb.core
import usb.util

# 
#USB_ID_VENDOR = 0x1234
#USB_ID_PRODUCT = 0x5678
USB_ID_VENDOR = 0x0C72
USB_ID_PRODUCT = 0x000C

#print(usb.core.show_devices())

#usb_dev = usb.core.find(find_all=True,idVendor=USB_ID_VENDOR,idProduct=USB_ID_PRODUCT,backend=libusb1.get_backend() )
#for dev in usb_dev :
#  print(dev)

usb_dev = usb.core.find(idVendor=USB_ID_VENDOR,idProduct=USB_ID_PRODUCT,backend=libusb1.get_backend() )
print(usb_dev)

usb_dev.write(0x01,"1")

while True:
  data = usb_dev.read(0x81, 64,-1)
  print(data)
  usb_dev.write(0x01,data)
